#include <bits/stdc++.h>

using namespace std;

unordered_map<string,int>mp;

int fc(int n1,int n2){
	if(n2>=n1){
		return n2-n1;
	}else{
		return 11-n1+n2+1;
	}
}

int main(int argc, char const *argv[])
{
	mp["C"]=0;
	mp["C#"]=1;
	mp["D"]=2;
	mp["D#"]=3;
	mp["E"]=4;
	mp["F"]=5;
	mp["F#"]=6;
	mp["G"]=7;
	mp["G#"]=8;
	mp["A"]=9;
	mp["A#"]=10;
	mp["B"]=11;
	int T;scanf("%d%",&T);
	string a,b,c;
	for (int i = 0; i < T; ++i)
	{
		cin>>a>>b>>c;
		int n1=mp[a],n2=mp[b],n3=mp[c];
		int m=fc(n1,n2),n=fc(n2,n3);
		if(m==4&&n==3){
			printf("Major triad\n");
		}else if(m==3&&n==4){
			printf("Minor triad\n");
		}else{
			printf("Dissonance\n");
		}
	}	
	return 0;
}